function calculatedGrossProfit(costList, retailList,costChangeFlag,costChangeOnly) {
    if (!isNull(costList) && !isNull(retailList)) {
        //毛利集合
        var profitList = [];
        for (var i = 0; i < costList.length; i++) {
            var cost = costList[i];
            var changeFlag = false;
            if (!isNull(cost.change) && cost.change) {
                changeFlag = true;
            }
            //过期代码请无视
            // if (i !== costList.length - 1 && cost.expDate === costList[i + 1].effDate && changeFlag && cost.type === 'old'){
            //     continue;
            // }
            for (var j = 0; j < retailList.length; j++) {
                var retail = retailList[j];
                if (isNotEmpty(retail) && isNotEmpty(retail.effDate) && isNotEmpty(retail.expDate) && retail.effDate === retail.expDate) {
                    continue;
                }
                if (isNotEmpty(costChangeFlag) && false === costChangeFlag){
                    if (retail.type === 'old'){
                        continue;
                    }
                }
                if (i !== costList.length - 1 && cost.expDate === costList[i + 1].effDate && changeFlag && cost.type === 'old' ){
                    if (retail.type === 'old'){
                        continue;
                    }
                }
                var b = isDateIntersection(retail.effDate,retail.expDate,cost.effDate, cost.expDate);
                if ((cost.type === 'old' && retail.type ==='old') && !b){
                    continue;
                }
                if (!isNull(retail.expDate) && !isNull(cost.effDate) && !isNull(cost.cost) && !isNull(retail.retail) && b
                    && retail.expDate !== cost.effDate) {
                    if (((isDateBetween(retail.effDate, cost.effDate, cost.expDate) || (isDateBetween(retail.expDate, cost.effDate, cost.expDate)))
                        || (costChangeOnly && isDateBetween(cost.effDate, retail.effDate, retail.expDate)))) {
                        //1-((成本*税率)/(零售*箱包))
                        var number = 1 - ((cost.cost * cost.rate) / (retail.retail * cost.size));
                        var profit = number.toFixed(4);
                        profitList.push(profit);
                    }
                }

            }
        }
        return profitList;
    }


}
